package com.itboye.boyeshoping.fragment

import android.content.Intent
import android.view.View
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.TextView
import com.itboye.boyeshoping.R
import com.itboye.boyeshoping.activity.ActivityMessageNotify
import com.itboye.boyeshoping.activity.PayRecordActivity
import com.itboye.boyeshoping.activity.PresentManey
import com.itboye.boyeshoping.base.BaseFragment

/**
 * Created by Administrator on 2018/6/27 0027.
 */
class MyFragment :BaseFragment() , View.OnClickListener {

    private lateinit var head:ImageView
    private lateinit var nick:TextView
    private lateinit var canPresentNum:TextView

    private lateinit var payRecord:LinearLayout
    private lateinit var notifyMessage:LinearLayout
    private lateinit var presentRecord:LinearLayout
    private lateinit var feedBack:LinearLayout
    private lateinit var clearCache:LinearLayout
    private lateinit var update:LinearLayout
    private lateinit var recommendFrends:LinearLayout
    private lateinit var unLogin:TextView

    override fun initView(): Int {
    return R.layout.fragment_wode
    }

    override fun onMyActivityCreated() {

        initFindView()
    }

    private fun initFindView() {
        head= activity!!.findViewById(R.id.head) as ImageView
        nick= activity!!.findViewById(R.id.nick) as TextView
        canPresentNum= activity!!.findViewById(R.id.canPresentNum) as TextView

        payRecord= activity!!.findViewById(R.id.payRecord) as LinearLayout
        notifyMessage= activity!!.findViewById(R.id.notifyMessage) as LinearLayout
        presentRecord= activity!!.findViewById(R.id.presentRecord) as LinearLayout
        feedBack= activity!!.findViewById(R.id.feedBack) as LinearLayout
        clearCache= activity!!.findViewById(R.id.clearCache) as LinearLayout
        update= activity!!.findViewById(R.id.update) as LinearLayout
        recommendFrends= activity!!.findViewById(R.id.recommendFrends) as LinearLayout
        unLogin= activity!!.findViewById(R.id.unLogin) as TextView

        head.setOnClickListener(this)
        nick.setOnClickListener(this)
        payRecord.setOnClickListener(this)
        notifyMessage.setOnClickListener(this)
        presentRecord.setOnClickListener(this)
        unLogin.setOnClickListener(this)

    }


    override fun onClick(p0: View?) {

         when(p0!!.id){

             R.id.head ->{//头像

             }

             R.id.nick ->{//昵称

             }

             R.id.payRecord ->{//支付记录
              startActivity(Intent(activity,PayRecordActivity::class.java))
             }
             R.id.notifyMessage ->{//消息通知
              startActivity(Intent(activity,ActivityMessageNotify::class.java))
             }

             R.id.presentRecord ->{ //提现记录
              startActivity(Intent(activity,PresentManey::class.java))
             }

             R.id.unLogin ->{ //退出登录

             }


         }
    }

}